package com.hyacinth.cloudnote.modules.note.repository;

import com.hyacinth.cloudnote.modules.note.model.Note;
import com.hyacinth.cloudnote.modules.note.model.NoteTag;
import com.hyacinth.cloudnote.modules.note.model.Tag;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.Repository;

import java.util.List;
import java.util.Optional;
import java.util.UUID;

/**
 * Tag实体类对应的基础业务Repository
 */
@org.springframework.stereotype.Repository
public interface NoteTagRepository extends Repository<NoteTag, UUID> {

    NoteTag save(NoteTag model);

    Optional<NoteTag> findById(UUID id);

    Page<NoteTag> findAll(Pageable pageable);

    void delete(NoteTag tag);

    void deleteAllByTag(Tag tag);

    void deleteAllByNote(Note note);

    List<NoteTag> findByNote(Note note);

}
